package com.sunlands.zlcx.usercenter.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.io.Serializable;
import java.util.Date;

/**
 * @author gaoyanfeng
 * description: 用户天学习信息
 */
@Data
@Entity(name = "tz_user_day_learn")
@NoArgsConstructor
@AllArgsConstructor
@Builder
@DynamicUpdate
@DynamicInsert
@ApiModel(value = "日学习信息")
public class UserDayLearnDO implements Serializable {
    private static final long serialVersionUID = 3707494491431710998L;

    public UserDayLearnDO(Long userId, String yearMonths, String yearMonthsDay, Integer ordernaryMinutes, Integer lianmaiMinutes, Long targetId) {
        this.userId = userId;
        this.yearMonths = yearMonths;
        this.yearMonthsDay = yearMonthsDay;
        this.ordernaryMinutes = ordernaryMinutes;
        this.lianmaiMinutes = lianmaiMinutes;
        this.targetId = targetId;
//        this.countTime = countTime;
        this.studyMinutes = ordernaryMinutes + lianmaiMinutes;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private Long userId;
    private String yearMonths;
    private String yearMonthsDay;
    @ApiModelProperty(value = "学习记时时间")
    private Integer ordernaryMinutes = 0;
    @ApiModelProperty(value = "连麦时间")
    private Integer lianmaiMinutes = 0;
    @ApiModelProperty(value = "学习时间")
    private Integer studyMinutes = 0;
    private Long targetId;
    /**
     * 状态
     */
    private Integer status;

//    private Date countTime;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;

    /**
     * 修改时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime;
}
